package com.exigenservices.practice.roadcompanion.server.service;

import com.exigenservices.practice.roadcompanion.server.entity.Points;
import com.exigenservices.practice.roadcompanion.server.entity.User;
import com.exigenservices.practice.roadcompanion.server.entity.UserInfo;
import com.exigenservices.practice.roadcompanion.server.entity.UserRoutes;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Minsk
 * Date: 15.07.13
 * Time: 18:39
 * To change this template use File | Settings | File Templates.
 */
public class DUser {
    private User user;
    private UserInfo userInfo;
    private List<DRoute> routes = new ArrayList<DRoute>();

    protected User getUser() {
        return user;
    }

    protected UserInfo getUserInfo() {
        return userInfo;
    }

    protected DUser(User user, UserInfo userInfo) {
        this.user = user;
        this.userInfo = userInfo;
    }

    protected DRoute addRoute(UserRoutes route, List<Points> points) {
        DRoute dRoute = new DRoute(route);
        this.routes.add(dRoute);
        for (Points point : points) {
            if (dRoute.getID() == point.getRouteID()) {
                dRoute.addPoint(point);
            }
        }
        return dRoute;
    }

    public List<DRoute> getRoutes() {
        return routes;
    }


    public long getID() {
        return user.getID();
    }

    public void setLogin(String login) {
        user.setLogin(login);
    }

    public String getLogin() {
        return user.getLogin();
    }

    public String getPassword() {
        return user.getPassword();
    }

    public void setPassword(String password) {
        user.setPassword(password);
    }

    public void setID(int id) {
        user.setID(id);
    }

    public Long getUserID() {
        return userInfo.getUserID();
    }

    public void setSurname(String surname) {
        userInfo.setSurname(surname);
    }

    public void setNumber(String number) {
        userInfo.setNumber(number);
    }

    public void setName(String name) {
        userInfo.setName(name);
    }

    public void setUserID(Long userID) {
        userInfo.setUserID(userID);
    }

    public String getSurname() {
        return userInfo.getSurname();
    }

    public String getName() {
        return userInfo.getName();
    }

    public String getNumber() {
        return userInfo.getNumber();
    }
}
